import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {DeliveryBusinessForm, DeliveryBusinessQuery, DeliveryBusinessVO} from '@/api/kd/deliveryBusiness/types';

/**
 * 查询快递产品类型列表
 * @param query
 * @returns {*}
 */

export const listDeliveryBusiness = (query?: DeliveryBusinessQuery): AxiosPromise<DeliveryBusinessVO[]> => {
  return request({
    url: '/kd/deliveryBusiness/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询快递产品类型详细
 * @param id
 */
export const getDeliveryBusiness = (id: string | number): AxiosPromise<DeliveryBusinessVO> => {
  return request({
    url: '/kd/deliveryBusiness/' + id,
    method: 'get'
  });
};

/**
 * 新增快递产品类型
 * @param data
 */
export const addDeliveryBusiness = (data: DeliveryBusinessForm) => {
  return request({
    url: '/kd/deliveryBusiness',
    method: 'post',
    data: data
  });
};

/**
 * 修改快递产品类型
 * @param data
 */
export const updateDeliveryBusiness = (data: DeliveryBusinessForm) => {
  return request({
    url: '/kd/deliveryBusiness',
    method: 'put',
    data: data
  });
};

/**
 * 删除快递产品类型
 * @param id
 */
export const delDeliveryBusiness = (id: string | number | Array<string | number>) => {
  return request({
    url: '/kd/deliveryBusiness/' + id,
    method: 'delete'
  });
};
